<html><head><meta charset="gb2312"/><title>MemoryBank.pb</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font><font color="#3A3966">;   PureBasic - Memory example file
</font><font color="#3A3966">;
</font><font color="#3A3966">;    (c) 2001 - Fantaisie Software
</font><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font>
*MemoryID =<font color="#3A3966"> AllocateMemory</font>(1000) 

*Pointer = *MemoryID
<font color="#3A3966">CopyMemoryString</font>("Hello ", @*Pointer)
<font color="#3A3966">CopyMemoryString</font>("World")

*NewMemoryID =<font color="#3A3966"> ReAllocateMemory</font>(*MemoryID, 2000) <font color="#3A3966">; need more memory 
</font><b><font color="#3A3966">If</font></b> *NewMemoryID 
  <font color="#3A3966">; work with *NewMemoryID now with size 2000 
</font>  <font color="#3A3966">;
</font>  <b><font color="#3A3966">Debug</font></b> "The old content is still here:" 
  <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">PeekS</font>(*NewMemoryID) 
<font color="#3A3966">  FreeMemory</font>(*NewMemoryID) 
<b><font color="#3A3966">Else</font></b> 
  <font color="#3A3966">; resizing failed, keep working with *MemoryID (size 1000) 
</font>  <font color="#3A3966">; 
</font><font color="#3A3966">  FreeMemory</font>(*MemoryID) 
<b><font color="#3A3966">EndIf</font></b> 

</font></pre>
</body></html>
